# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Rule do
  @moduledoc """
  Represents the rule for a content warehouse trigger.

  ## Attributes

  *   `actions` (*type:* `list(GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Action.t)`, *default:* `nil`) - List of actions that are executed when the rule is satisfied.
  *   `condition` (*type:* `String.t`, *default:* `nil`) - Represents the conditional expression to be evaluated. Expression should evaluate to a boolean result. When the condition is true actions are executed. Example: user_role = "hsbc_role_1" AND doc.salary > 20000
  *   `description` (*type:* `String.t`, *default:* `nil`) - Short description of the rule and its context.
  *   `ruleId` (*type:* `String.t`, *default:* `nil`) - ID of the rule. It has to be unique across all the examples. This is managed internally.
  *   `triggerType` (*type:* `String.t`, *default:* `nil`) - Identifies the trigger type for running the policy.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :actions =>
            list(GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Action.t())
            | nil,
          :condition => String.t() | nil,
          :description => String.t() | nil,
          :ruleId => String.t() | nil,
          :triggerType => String.t() | nil
        }

  field(:actions,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Action,
    type: :list
  )

  field(:condition)
  field(:description)
  field(:ruleId)
  field(:triggerType)
end

defimpl Poison.Decoder, for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Rule do
  def decode(value, options) do
    GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Rule.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Rule do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
